home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gxctable.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.3 KB  |  65 lines

  1. /* Copyright (C) 1995, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gxctable.h,v 1.2 2000/09/19 19:00:35 lpd Exp $ */
  20. /* Interface to color table lookup and interpolation */
  21.  
  22. #ifndef gxctable_INCLUDED
  23. #  define gxctable_INCLUDED
  24.  
  25. #include "gxfixed.h"
  26. #include "gxfrac.h"
  27.  
  28. /*
  29.  * Define a 3- or 4-D color lookup table.
  30.  * n is the number of dimensions (input indices), 3 or 4.
  31.  * dims[0..n-1] are the table dimensions.
  32.  * m is the number of output values, typically 3 (RGB) or 4 (CMYK).
  33.  * For n = 3:
  34.  *   table[i], 0 <= i < dims[0], point to strings of length
  35.  *     dims[1] x dims[2] x m.
  36.  * For n = 4:
  37.  *   table[i], 0 <= i < dims[0] x dims[1], points to strings of length
  38.  *     dims[2] x dims[3] x m.
  39.  * It isn't really necessary to store the size of each string, since
  40.  * they're all the same size, but it makes things a lot easier for the GC.
  41.  */
  42. typedef struct gx_color_lookup_table_s {
  43.     int n;
  44.     int dims[4];        /* [ndims] */
  45.     int m;
  46.     const gs_const_string *table;
  47. } gx_color_lookup_table;
  48.  
  49. /*
  50.  * Interpolate in a 3- or 4-D color lookup table.
  51.  * pi[0..n-1] are the table indices, guaranteed to be in the ranges
  52.  * [0..dims[n]-1] respectively.
  53.  * Return interpolated values in pv[0..m-1].
  54.  */
  55.  
  56. /* Return the nearest value without interpolation. */
  57. void gx_color_interpolate_nearest(P3(const fixed * pi,
  58.                 const gx_color_lookup_table * pclt, frac * pv));
  59.  
  60. /* Use trilinear interpolation. */
  61. void gx_color_interpolate_linear(P3(const fixed * pi,
  62.                 const gx_color_lookup_table * pclt, frac * pv));
  63.  
  64. #endif /* gxctable_INCLUDED */
  65.